package com.example.newheze.Util;

import android.os.Handler;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class Sendcommand implements Runnable {

    private Handler handler;
    private String command;
    private Socket socket;
    private OutputStream outputStream;

    public Sendcommand(String command) {
        super();
        this.command = command;
    }

    @Override
    public void run() {

        try {
            socket=new Socket("202.194.131.174",8023);
            outputStream=socket.getOutputStream();
            outputStream.write(command.toString().getBytes("utf-8"));
        } catch (Exception e) {
            try {
                outputStream.close();
                socket.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }finally{
            try {
                outputStream.close();
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
